<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class Glory extends BaseModel
{
    public $table = 'glory_shop';
    public $connection = 'api';
    public function getlist(Request $request){
        $page = $request->get('page', 0);
        $limit = $request->get('limit', 10);
        $status = $request->get('status', '');

        $sql = DB::connection($this->connection)->table($this->table)->orderBy('sort','desc')->select('*');
        if ($status != ''){
            $sql->where('status',$status);
        }
        return $sql->paginate($limit, $this->fields, 'page', $page);
    }
    public function upsertGloryGoods($data){
        return curl_request(getKkaudioApiUrl().'/glory/upsertGloryGoods',$data,'json', 'POST');
    }
}
